<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%-- Declare the core library --%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>booksList</title>
</head>
<body>
	<h3>Welcome to book shop</h3>
	<table>
		<tr>
			<td style="width: 80%"></td>
			<td><c:out value="login=${sessionScope.USER_SESSION_KEY.login}" />
				<br /> <c:out value="name=${sessionScope.USER_SESSION_KEY.name}" />
				<br /> <c:out value="money on account=${sessionScope.USER_SESSION_KEY.money}" />
				<br /> <a href="./?cmd=OrderHistory">watch order history</a>
				<br/> <a href="./?cmd=InputAddMoney">set money to your account</a>
				<br/> <a href="./?cmd=LogOut">logout</a>
			</td>
		</tr>
	</table>

	<table>
		<tr>
			<td>
				<!-- Book list --> Book list:
				<table border="1px">
					<tr>
						<td>id</td>
						<td>name</td>
						<td>description</td>
						<td>price</td>
						<td>author</td>
						<td>add to basket</td>
					</tr>
					<c:forEach items="${requestScope.itemsList}" var="item">
						<tr>
							<td><c:out value="${item.id}" /></td>
							<td><c:out value="${item.name}" /></td>
							<td><c:out value="${item.description}" /></td>
							<td><c:out value="${item.price}" /></td>
							<td><c:out value="${item.author}" /></td>
							<td><a
								href="./?cmd=RemoveItem&itemID=${item.id}">remove</a>
							</td>
						</tr>
					</c:forEach>
				</table>
			<td />

			<td>
				<table>
					<tr>
						<td>
							<!-- Basket --> <c:choose>
								<c:when test="${empty sessionScope.BASKET_BEAN_SESSION_BEAN.itemList}"> 
								Your Basket is empty? , click "add" to add new book to your basket
							</c:when>
						<c:otherwise>		
									<table border="1px">
										<tr>
											<td>name</td>
											<td>price</td>
											<td>quantity</td>
											<td>remove</td>
										</tr>
										<c:forEach
											items="${sessionScope.BASKET_BEAN_SESSION_BEAN.itemList}"
											var="itemBean">
											<tr>
												<td><c:out value="${itemBean.item.name}" /></td>
												<td><c:out value="${itemBean.item.price}" /></td>
												<td><c:out value="${itemBean.quantity}" /></td>
												<td> <a href="./?cmd=DelItemFromBasket&itemID=${itemBean.item.id}">del</a></td>
											</tr>
										</c:forEach>
										<tr>
												<td></td>
												<td><c:out value="Total : ${sessionScope.BASKET_BEAN_SESSION_BEAN.totalCost}" /></td>
												<td></td>
												<td></td>
											</tr>
									</table>
									<a href="./?cmd=OrderItems">Order items</a>
									
									
							</c:otherwise>
							</c:choose>
						</td>



					</tr>
				</table>
			</td>
		</tr>
	</table>
</body>
</html>